--
-- Author: Millson Zhou
-- Date: 2014-07-03 20:56:11
--
local MenuScene = class("MenuScene", function()
    return display.newScene("MenuScene")
end)

function MenuScene:ctor()
    local bg = display.newSprite("img/map/mainMenu.jpg", display.cx, display.cy)
    self:addChild(bg)

    local items = {'剧情关卡', '无尽挑战', '女孩信息'}
    local labels = {}
    for _, item in ipairs(items) do
        local label = ui.newTTFLabelMenuItem({
            text = item,
            listener = function() self:on_click(item) end,
            color = cc.c3(0, 0, 0)
        })
        label:setAnchorPoint(cc.p(0, 0.5))
        labels[#labels + 1] = label
    end

    local menu = ui.newMenu(labels)
    menu:alignItemsVertically()
    menu:setPosition(20, display.cy)

    self:addChild(menu)
end

function MenuScene:on_click(name)
    if name == '剧情关卡' then
        display.replaceScene(require('app.scenes.level.LevelListScene').new(), "fade", 0.6, display.COLOR_WHITE)
    end

    if name == '无尽挑战' then
    end

    if name == '女孩信息' then
    end
end

function MenuScene:onEnter()
end

function MenuScene:onExit()
end

return MenuScene